home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Suzy B Software 2
/
Suzy B Software CD-ROM 2 (1994).iso
/
extras
/
programm
/
gemfsc19
/
gemfsc19.lzh
/
GEMFUNCS
/
OBJCLCAL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-05-07
|
2KB
|
82 lines
/**************************************************************************
* OBJCLCAL.C - Calc clipping rectangle(s) for object in a tree.
*************************************************************************/
#include "gemfintl.h"
short obj_clcalc(ptree, object, pgrect, pvrect)
register OBJECT *ptree;
short object;
GRECT *pgrect;
VRECT *pvrect;
{
short adjust;
long ospec;
short otype;
short oflags;
GRECT workrect;
obj_offxywh(ptree, object, &workrect); /* get basic placement/sizes */
ptree = &ptree[object]; /* registerize/precalc some */
otype = obj_gtype(ptree, ROOT); /* miscellanious things we */
ospec = obj_gvalue(ptree, ROOT); /* use a lot below. */
oflags = ptree->ob_flags;
/*
* deal with objects that can have graphics that extend outside
* their ob_width/ob_height values...
*/
switch (otype) {
case G_BOXTEXT:
case G_FBOXTEXT:
adjust = ((TEDINFO*)ospec)->te_thickness;
break;
case G_BOX:
case G_IBOX:
case G_BOXCHAR:
adjust = (short)((char)(ospec >> 16));
break;
case G_BUTTON:
adjust = -1;
if (oflags & EXIT)
--adjust;
if (oflags & DEFAULT)
--adjust;
break;
default:
adjust = 0;
break;
}
if (adjust > 0) { /* if adjust value is positive, object has */
adjust = 0; /* "inner width" and no adjustment is needed. */
} else { /* negative value implies outer width, invert */
adjust = -adjust; /* it to a positive number for rc_gadjust(). */
}
if (ptree->ob_state & OUTLINED) { /* OUTLINED objects get */
adjust = 4; /* a fixed adjustment. */
}
rc_gadjust(&workrect, adjust, adjust); /* apply adjustment */
if (ptree->ob_state & SHADOWED) { /* apply special adjust */
workrect.g_w += gl_wbox / 2; /* for SHADOWED objects. */
workrect.g_h += gl_hbox / 2;
}
if (pgrect != NULL) { /* if caller wants GRECT,*/
*pgrect = workrect; /* copy results to it. */
}
if (pvrect != NULL) { /* if caller wants VRECT,*/
rc_gtov(&workrect, pvrect); /* convert results to it.*/
}
return adjust;
}